<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script>
			/**
			 * @param {number[]} nums
			 * @param {number} target
			 * @return {number[]}
			 */
			//输入：nums = [2,7,11,15], target = 9
			//输出：[0,1]
			//解释：因为 nums[0] + nums[1] == 9 ，返回 [0, 1] 。
			const arr = [2,7,11,15];
			var twoSum = function(nums, target) {
				for(let i = 0;i<=nums.length-1;i++){
					for(let j = i+1;j<=nums.length-1;j++){
						if(nums[i] + nums[j] == target){
							return [i,j];
						}
					}
				}
			};
			console.log(twoSum(arr,9));
		</script>
	</body>
</html>
